package com.sline.stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo5_Chinese {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("abc.txt");

        byte[] arr = new byte[4];
        int len;
        while ((len = fis.read(arr)) != -1) {
            System.out.println(new String(arr, 0, len));
        }

        fis.close();

        FileOutputStream fos = new FileOutputStream("xxx.txt");

        fos.write("你好, 世界, 我爱你".getBytes());
        fos.write("\r\n".getBytes());

        fos.close();

    }
}
